package com.qire.manhua.model.vo;

import com.qire.common.basic.DateUtil;

import java.util.List;

public class HomeRecommendNewComicItemVO {

    public int          book_id;        //: 10623,
    public String       book_name;      //: "妙手天医在都市",
    public String       book_author;    //: "天翼爱动漫",
    public String       cover_img;      //: "https://p.qiremanhua.com/uploads/book/201902/5c765722de490.jpg",
    public String       short_title;    //: "祖传圣医经被夺，平凡小伙无奈开启“流氓天医”模式…",
    public String       update_time;    //: "2019-02-27 17:24:44",
    public List<String> tags;           //: ["都市","奇幻"]

    public String toDescribe() {
//        update_time = "2019-04-21 13:08:44";//测试数据，单元测试需注意 时分秒和今天的时分秒不满1天，日期却在下一个日期的情况
        String describe = "今日上架";

        // todo: 需要计算一天内时间的情况
        long dayCount = DateUtil.yMdHms.toToday(update_time).time;

        if(dayCount == 1) {
            describe = "昨日上架";
        }
        if(dayCount > 1 || dayCount < 0) {
            describe = update_time.substring(5, 10) + "上架";
        }

        return describe;
    }

}
